﻿using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;

Enumerable.Range(1, 100).AsParallel().ForAll(i => {
    using var bitmap = new Bitmap(2500, 2500, PixelFormat.Format24bppRgb);
    BitmapData data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, bitmap.PixelFormat);

    byte[] noise = new byte[data.Width * data.Height * 3];
    new Random().NextBytes(noise);
    Marshal.Copy(noise, 0, data.Scan0, noise.Length);

    bitmap.UnlockBits(data);

    using var graphics = Graphics.FromImage(bitmap);
    graphics.DrawString(
        i.ToString().PadLeft(3, '0'),
        new Font(SystemFonts.DefaultFont.FontFamily, 500), Brushes.Black, 0, 0);

    var fileName = Path.GetRandomFileName();
    fileName = Path.ChangeExtension(fileName, null);
    bitmap.Save($"out/i{i.ToString().PadLeft(3, '0')}{fileName}.bmp", ImageFormat.Bmp);
});
